import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Bullet's shot by Dr. Wily
 */
public class Bullet  extends Mover
{
    Simon simon;
    Health health;

    retroWorld theWorld;

    /**
     * Act - do whatever the Bullet wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.
        move(-1.0);
        
        if (intersects(simon))
        {
            health.takeDamage();
            
        }
        
        if (getX() < 10)
            theWorld.removeObject(this);
    } 
    
    public void addedToWorld(World world)
    {
        theWorld = (retroWorld)world;
        simon = theWorld.getSimon();
        health = theWorld.getHealth();
    }
}
